import 'package:aitao_flutter/res/r.dart';

class CommonUtils {
  static bool isImageSuffix(String imgUrl) {
    if (imgUrl.endsWith('.png') ||
        imgUrl.endsWith('.jpg') ||
        imgUrl.endsWith('.jpeg')) {
      return true;
    }
    return false;
  }

  static String setVipImagePath(int vip, int vipLevel) {
    if (vip == 0) {
      if (vipLevel == 3) {
        return ImagePath.assetsImagesGoldVip1;
      } else if (vipLevel == 2) {
        return ImagePath.assetsImagesGoldVip2;
      } else if (vipLevel == 1) {
        return ImagePath.assetsImagesGoldVip3;
      }
      return ImagePath.assetsImagesGoldVip1;
    }
    if (vip == 1) {
      if (vipLevel == 3) {
        return ImagePath.assetsImagesDiamondVip1;
      } else if (vipLevel == 2) {
        return ImagePath.assetsImagesDiamondVip2;
      } else if (vipLevel == 1) {
        return ImagePath.assetsImagesDiamondVip3;
      }
    }
    return ImagePath.assetsImagesGoldVip1;
  }

  static String formatNumberWithTenThousand(int number) {
    if (number >= 10000) {
      double result = number / 10000.0;
      return '${result.toStringAsFixed(1)}万';
    } else {
      return number.toString();
    }
  }
}
